<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"vchao.top","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="Android应用开发过程中，ViewPager同时加载多个fragment，以实现多tab页面快速切换, 但是fragment初始化时若加载的内容较多，就可能导致整个应用启动速度缓慢，影响用户体验。为了提高用户体验，我们会使用一些懒加载方案，实现加载延迟。这时我们会用到getUserVisibleHint()与setUserVisibleHint()这两个方法。 生命周期首先先从Fragmen">
<meta property="og:type" content="article">
<meta property="og:title" content="安卓：Fragment的懒加载">
<meta property="og:url" content="http://vchao.top/2017/05/12/%E5%AE%89%E5%8D%93%EF%BC%9AFragment%E7%9A%84%E6%87%92%E5%8A%A0%E8%BD%BD/index.html">
<meta property="og:site_name" content="乘风破浪">
<meta property="og:description" content="Android应用开发过程中，ViewPager同时加载多个fragment，以实现多tab页面快速切换, 但是fragment初始化时若加载的内容较多，就可能导致整个应用启动速度缓慢，影响用户体验。为了提高用户体验，我们会使用一些懒加载方案，实现加载延迟。这时我们会用到getUserVisibleHint()与setUserVisibleHint()这两个方法。 生命周期首先先从Fragmen">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://img.blog.csdn.net/20160428203327414">
<meta property="article:published_time" content="2017-05-12T12:03:39.000Z">
<meta property="article:modified_time" content="2021-08-25T14:37:20.804Z">
<meta property="article:author" content="vchao">
<meta property="article:tag" content="Android">
<meta property="article:tag" content="Fragment">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://img.blog.csdn.net/20160428203327414">

<link rel="canonical" href="http://vchao.top/2017/05/12/%E5%AE%89%E5%8D%93%EF%BC%9AFragment%E7%9A%84%E6%87%92%E5%8A%A0%E8%BD%BD/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>安卓：Fragment的懒加载 | 乘风破浪</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">乘风破浪</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://vchao.top/2017/05/12/%E5%AE%89%E5%8D%93%EF%BC%9AFragment%E7%9A%84%E6%87%92%E5%8A%A0%E8%BD%BD/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="vchao">
      <meta itemprop="description" content="怀揣好奇，梦想改变世界的菜鸟极客">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="乘风破浪">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          安卓：Fragment的懒加载
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2017-05-12 20:03:39" itemprop="dateCreated datePublished" datetime="2017-05-12T20:03:39+08:00">2017-05-12</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-08-25 22:37:20" itemprop="dateModified" datetime="2021-08-25T22:37:20+08:00">2021-08-25</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Android/" itemprop="url" rel="index"><span itemprop="name">Android</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>﻿Android应用开发过程中，ViewPager同时加载多个fragment，以实现多tab页面快速切换, 但是fragment初始化时若加载的内容较多，就可能导致整个应用启动速度缓慢，影响用户体验。<br>为了提高用户体验，我们会使用一些懒加载方案，实现加载延迟。这时我们会用到getUserVisibleHint()与setUserVisibleHint()这两个方法。</p>
<h1 id="生命周期"><a href="#生命周期" class="headerlink" title="生命周期"></a>生命周期</h1><p>首先先从Fragment的生命周期开始说起，讲一讲Fragment每个生命周期方法的意义、作用：</p>
<h3 id="setUserVisibleHint-："><a href="#setUserVisibleHint-：" class="headerlink" title="setUserVisibleHint()："></a>setUserVisibleHint()：</h3><p>设置Fragment可见或者不可见时会调用此方法。在该方法里面可以通过调用getUserVisibleHint()获得Fragment的状态是可见还是不可见的，如果可见则进行懒加载操作。</p>
<h3 id="onAttach-："><a href="#onAttach-：" class="headerlink" title="onAttach()："></a>onAttach()：</h3><p>执行该方法时，Fragment与Activity已经完成绑定，该方法有一个Activity类型的参数，代表绑定的Activity，这时候你可以执行诸如mActivity = activity的操作。</p>
<h3 id="onCreate-："><a href="#onCreate-：" class="headerlink" title="onCreate()："></a>onCreate()：</h3><p>初始化Fragment。可通过参数savedInstanceState获取之前保存的值。</p>
<h3 id="onCreateView-："><a href="#onCreateView-：" class="headerlink" title="onCreateView()："></a>onCreateView()：</h3><p>初始化Fragment的布局。加载布局和findViewById的操作通常在此函数内完成，但是不建议执行耗时的操作，比如读取数据库数据列表。</p>
<h3 id="onActivityCreated-："><a href="#onActivityCreated-：" class="headerlink" title="onActivityCreated()："></a>onActivityCreated()：</h3><p>执行该方法时，与Fragment绑定的Activity的onCreate方法已经执行完成并返回，在该方法内可以进行与Activity交互的UI操作，所以在该方法之前Activity的onCreate方法并未执行完成，如果提前进行交互操作，会引发空指针异常。</p>
<h3 id="onStart-："><a href="#onStart-：" class="headerlink" title="onStart()："></a>onStart()：</h3><p>执行该方法时，Fragment由不可见变为可见状态。</p>
<h3 id="onResume-："><a href="#onResume-：" class="headerlink" title="onResume()："></a>onResume()：</h3><p>执行该方法时，Fragment处于活动状态，用户可与之交互。</p>
<h3 id="onPause-："><a href="#onPause-：" class="headerlink" title="onPause()："></a>onPause()：</h3><p>执行该方法时，Fragment处于暂停状态，但依然可见，用户不能与之交互。</p>
<h3 id="onSaveInstanceState-："><a href="#onSaveInstanceState-：" class="headerlink" title="onSaveInstanceState()："></a>onSaveInstanceState()：</h3><p>保存当前Fragment的状态。该方法会自动保存Fragment的状态，比如EditText键入的文本，即使Fragment被回收又重新创建，一样能恢复EditText之前键入的文本。</p>
<h3 id="onStop-："><a href="#onStop-：" class="headerlink" title="onStop()："></a>onStop()：</h3><p>执行该方法时，Fragment完全不可见。</p>
<h3 id="onDestroyView-："><a href="#onDestroyView-：" class="headerlink" title="onDestroyView()："></a>onDestroyView()：</h3><p>销毁与Fragment有关的视图，但未与Activity解除绑定，依然可以通过onCreateView方法重新创建视图。通常在ViewPager+Fragment的方式下会调用此方法。</p>
<h3 id="onDestroy-："><a href="#onDestroy-：" class="headerlink" title="onDestroy()："></a>onDestroy()：</h3><p>销毁Fragment。通常按Back键退出或者Fragment被回收时调用此方法。</p>
<h3 id="onDetach-："><a href="#onDetach-：" class="headerlink" title="onDetach()："></a>onDetach()：</h3><p>解除与Activity的绑定。在onDestroy方法之后调用。</p>
<p>Fragment生命周期执行流程：<br>Fragment创建：setUserVisibleHint()-&gt;onAttach()-&gt;onCreate()-&gt;onCreateView()-&gt;onActivityCreated()-&gt;onStart()-&gt;onResume()；<br>Fragment变为不可见状态（锁屏、回到桌面、被Activity完全覆盖）：onPause()-&gt;onSaveInstanceState()-&gt;onStop()；<br>Fragment变为部分可见状态（打开Dialog样式的Activity）：onPause()-&gt;onSaveInstanceState()；<br>Fragment由不可见变为活动状态：onStart()-&gt;OnResume()；<br>Fragment由部分可见变为活动状态：onResume()；<br>退出应用：onPause()-&gt;onStop()-&gt;onDestroyView()-&gt;onDestroy()-&gt;onDetach()（注意退出不会调用onSaveInstanceState方法，因为是人为退出，没有必要再保存数据）；<br>Fragment被回收又重新创建：被回收执行onPause()-&gt;onSaveInstanceState()-&gt;onStop()-&gt;onDestroyView()-&gt;onDestroy()-&gt;onDetach()，重新创建执行onAttach()-&gt;onCreate()-&gt;onCreateView()-&gt;onActivityCreated()-&gt;onStart()-&gt;onResume()-&gt;setUserVisibleHint()；<br>横竖屏切换：与Fragment被回收又重新创建一样。</p>
<h1 id="看一下源码"><a href="#看一下源码" class="headerlink" title="看一下源码"></a>看一下源码</h1><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">* <span class="doctag">@param</span> isVisibleToUser true if this fragment&#x27;s UI is currently visible to the user (default),</span></span><br><span class="line"><span class="comment">*                        false if it is not.</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setUserVisibleHint</span><span class="params">(<span class="keyword">boolean</span> isVisibleToUser)</span> </span>&#123;</span><br><span class="line">   <span class="keyword">if</span> (!mUserVisibleHint &amp;&amp; isVisibleToUser &amp;&amp; mState &lt; STARTED) &#123;</span><br><span class="line">       mFragmentManager.performPendingDeferredStart(<span class="keyword">this</span>);</span><br><span class="line">   &#125;</span><br><span class="line">   mUserVisibleHint = isVisibleToUser;</span><br><span class="line">   mDeferStart = !isVisibleToUser;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> The current value of the user-visible hint on this fragment.</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@see</span> #setUserVisibleHint(boolean)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">getUserVisibleHint</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="keyword">return</span> mUserVisibleHint;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>从上述源码注释我们可以看出，当fragment被用户可见时，setUserVisibleHint()会调用且传入true值，当fragment不被用户可见时，setUserVisibleHint()则得到false值。而在传统的fragment生命周期里也看不到这个函数。</p>
<p><img src="http://img.blog.csdn.net/20160428203327414" alt="fragment生命周期"> </p>
<p>那么，问题来了，<br>fragment是如何知道自己时候用户可见？<br>setUserVisibleHint() 在上图所示fragment的生命周期的什么位置?</p>
<p><strong>先说结论：</strong></p>
<ol>
<li>viewpager监听切换tab事件，tab切换一次，执行一次setUserVisibleHint()方法</li>
<li>setUserVisibleHint() 在 上图所示fragment所有生命周期之前，无论viewpager是在activity哪个生命周期里初始化。</li>
<li>activity生命周期 和 fragment生命周期 时序并不是按序来的，也就是说fragment的oncreate方法时序并不一定在activity的oncreate方法之后。</li>
</ol>
<p>具体原因，我们从应用场景开始一点一点的分析。</p>
<h2 id="1-我们的使用场景："><a href="#1-我们的使用场景：" class="headerlink" title="1. 我们的使用场景："></a>1. 我们的使用场景：</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MainActivity</span> <span class="keyword">extends</span> <span class="title">FragmentActivity</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> ViewPager viewPager;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">onCreate</span><span class="params">(Bundle savedInstanceState)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">super</span>.onCreate(savedInstanceState);</span><br><span class="line"></span><br><span class="line">        viewPager = (ViewPager) findViewById(R.id.viewpager);</span><br><span class="line">        vpOrder.setAdapter(<span class="keyword">new</span> MainFragmentPagerAdapter(getSupportFragmentManager()));</span><br><span class="line">        vpOrder.setOffscreenPageLimit(<span class="number">5</span>);</span><br><span class="line">        vpOrder.setCurrentItem(<span class="number">0</span>);</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">｝</span><br></pre></td></tr></table></figure>
<h2 id="2-ViewPager-FragmentPagerAdapter"><a href="#2-ViewPager-FragmentPagerAdapter" class="headerlink" title="2.ViewPager ,FragmentPagerAdapter"></a>2.ViewPager ,FragmentPagerAdapter</h2><ul>
<li>/frameworks/base/core/java/android/app/Activity.java<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//每次切换ViewPager的Tab时调用的方法</span></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">populate</span><span class="params">(<span class="keyword">int</span> newCurrentItem)</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">        mAdapter.startUpdate(<span class="keyword">this</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//......</span></span><br><span class="line">        addNewItem(mCurItem, curIndex);</span><br><span class="line">        <span class="comment">// mCurItem 为当前可见Fragment</span></span><br><span class="line">        <span class="comment">// 调用setUserVisibleHint(true)</span></span><br><span class="line">        mAdapter.setPrimaryItem(<span class="keyword">this</span>, mCurItem, curItem != <span class="keyword">null</span> ? curItem.object : <span class="keyword">null</span>); </span><br><span class="line"></span><br><span class="line">        mAdapter.finishUpdate(<span class="keyword">this</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//.....</span></span><br><span class="line"></span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function">ItemInfo <span class="title">addNewItem</span><span class="params">(<span class="keyword">int</span> position, <span class="keyword">int</span> index)</span> </span>&#123;</span><br><span class="line">        ItemInfo ii = <span class="keyword">new</span> ItemInfo();</span><br><span class="line">        ii.position = position;</span><br><span class="line">        <span class="comment">//初始化fragment, 调用setUserVisibleHint(false)</span></span><br><span class="line">        ii.object = mAdapter.instantiateItem(<span class="keyword">this</span>, position);</span><br><span class="line">        ii.widthFactor = mAdapter.getPageWidth(position);</span><br><span class="line">        <span class="keyword">if</span> (index &lt; <span class="number">0</span> || index &gt;= mItems.size()) &#123;</span><br><span class="line">            mItems.add(ii);</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            mItems.add(index, ii);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> ii;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="3-Activity-FragmentManager"><a href="#3-Activity-FragmentManager" class="headerlink" title="3.  Activity , FragmentManager"></a>3.  Activity , FragmentManager</h2></li>
<li>/frameworks/support/v4/java/android/support/v4/app/FragmentManager.java<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line">   <span class="meta">@Override</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> Object <span class="title">instantiateItem</span><span class="params">(ViewGroup container, <span class="keyword">int</span> position)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (mCurTransaction == <span class="keyword">null</span>) &#123;</span><br><span class="line">        mCurTransaction = mFragmentManager.beginTransaction();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">final</span> <span class="keyword">long</span> itemId = getItemId(position);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// Do we already have this fragment?</span></span><br><span class="line">    String name = makeFragmentName(container.getId(), itemId);</span><br><span class="line">    Fragment fragment = mFragmentManager.findFragmentByTag(name);</span><br><span class="line">    <span class="keyword">if</span> (fragment != <span class="keyword">null</span>) &#123;</span><br><span class="line">        <span class="keyword">if</span> (DEBUG) Log.v(TAG, <span class="string">&quot;Attaching item #&quot;</span> + itemId + <span class="string">&quot;: f=&quot;</span> + fragment);</span><br><span class="line">        mCurTransaction.attach(fragment);</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        fragment = getItem(position);</span><br><span class="line">        <span class="keyword">if</span> (DEBUG) Log.v(TAG, <span class="string">&quot;Adding item #&quot;</span> + itemId + <span class="string">&quot;: f=&quot;</span> + fragment);</span><br><span class="line">        <span class="comment">//将fragment添加到FragmentManager里面</span></span><br><span class="line">        mCurTransaction.add(container.getId(), fragment,</span><br><span class="line">                makeFragmentName(container.getId(), itemId));</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> (fragment != mCurrentPrimaryItem) &#123;</span><br><span class="line">        fragment.setMenuVisibility(<span class="keyword">false</span>);</span><br><span class="line">        <span class="comment">//我们要找的方法在这里</span></span><br><span class="line">        fragment.setUserVisibleHint(<span class="keyword">false</span>); </span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> fragment;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setPrimaryItem</span><span class="params">(ViewGroup container, <span class="keyword">int</span> position, Object object)</span> </span>&#123;</span><br><span class="line">    Fragment fragment = (Fragment)object;</span><br><span class="line">    <span class="keyword">if</span> (fragment != mCurrentPrimaryItem) &#123;</span><br><span class="line">        <span class="keyword">if</span> (mCurrentPrimaryItem != <span class="keyword">null</span>) &#123;</span><br><span class="line">            mCurrentPrimaryItem.setMenuVisibility(<span class="keyword">false</span>);</span><br><span class="line">            mCurrentPrimaryItem.setUserVisibleHint(<span class="keyword">false</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (fragment != <span class="keyword">null</span>) &#123;</span><br><span class="line">            <span class="comment">//我们要找的方法在这里</span></span><br><span class="line">            fragment.setMenuVisibility(<span class="keyword">true</span>);</span><br><span class="line">            fragment.setUserVisibleHint(<span class="keyword">true</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        mCurrentPrimaryItem = fragment;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure></li>
</ul>
<p>/frameworks/support/v4/java/android/support/v4/app/FragmentManager.java</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//分发onCreate事件函数</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">dispatchCreate</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    mStateSaved = <span class="keyword">false</span>;</span><br><span class="line">    moveToState(Fragment.CREATED, <span class="keyword">false</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//moveToState 重载 1</span></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">moveToState</span><span class="params">(<span class="keyword">int</span> newState, <span class="keyword">boolean</span> always)</span> </span>&#123;</span><br><span class="line">    moveToState(newState, <span class="number">0</span>, <span class="number">0</span>, always);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//moveToState 重载 2</span></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">moveToState</span><span class="params">(<span class="keyword">int</span> newState, <span class="keyword">int</span> transit, <span class="keyword">int</span> transitStyle, <span class="keyword">boolean</span> always)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (mHost == <span class="keyword">null</span> &amp;&amp; newState != Fragment.INITIALIZING) &#123;</span><br><span class="line">        <span class="keyword">throw</span> <span class="keyword">new</span> IllegalStateException(<span class="string">&quot;No host&quot;</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (!always &amp;&amp; mCurState == newState) &#123;</span><br><span class="line">        <span class="keyword">return</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    mCurState = newState;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="comment">//若mActive为null,就算Activtiy里面调用了dispatchOnCreate()也不会执行Fragment</span></span><br><span class="line">    <span class="comment">//的OnAttach和onCreate等方法。</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">//只有mActive非null,即addFragment()执行后，才会真正进入到生命周期。</span></span><br><span class="line">    <span class="comment">//而根据FragmentPagerAdapter可知，只有当viewpager调用setAdapter方法，才会添加fragment到FramentManager。</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">//执行setAdapter的时候，会调用setUserVisibleHint()方法，并且，只有当setAdapter方法执行完之后，才会进入到Fragment到生命周期，因此setUserVisibleHint()方法在所有生命周期之前被调用。</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (mActive != <span class="keyword">null</span>) &#123;</span><br><span class="line">        <span class="keyword">boolean</span> loadersRunning = <span class="keyword">false</span>;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i=<span class="number">0</span>; i&lt;mActive.size(); i++) &#123;</span><br><span class="line">            Fragment f = mActive.get(i);</span><br><span class="line">            <span class="keyword">if</span> (f != <span class="keyword">null</span>) &#123;</span><br><span class="line">                moveToState(f, newState, transit, transitStyle, <span class="keyword">false</span>);</span><br><span class="line">                <span class="keyword">if</span> (f.mLoaderManager != <span class="keyword">null</span>) &#123;</span><br><span class="line">                    loadersRunning |= f.mLoaderManager.hasRunningLoaders();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span> (!loadersRunning) &#123;</span><br><span class="line">            startPendingDeferredFragments();</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span> (mNeedMenuInvalidate &amp;&amp; mHost != <span class="keyword">null</span> &amp;&amp; mCurState == Fragment.RESUMED) &#123;</span><br><span class="line">            mHost.onSupportInvalidateOptionsMenu();</span><br><span class="line">            mNeedMenuInvalidate = <span class="keyword">false</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//moveToState 重载 3</span></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">moveToState</span><span class="params">(Fragment f, <span class="keyword">int</span> newState, <span class="keyword">int</span> transit, <span class="keyword">int</span> transitionStyle,</span></span></span><br><span class="line"><span class="params"><span class="function"></span></span></span><br><span class="line"><span class="params"><span class="function">         //...</span></span></span><br><span class="line"><span class="params"><span class="function"></span></span></span><br><span class="line"><span class="params"><span class="function">         f.onAttach()</span></span>;</span><br><span class="line"></span><br><span class="line">         <span class="comment">//...</span></span><br><span class="line"></span><br><span class="line">         f.performOnCreate();</span><br><span class="line"></span><br><span class="line">         <span class="comment">//其他生命周期</span></span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">//添加fragment到FragmentManager</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">addFragment</span><span class="params">(Fragment fragment, <span class="keyword">boolean</span> moveToStateNow)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (mAdded == <span class="keyword">null</span>) &#123;</span><br><span class="line">        mAdded = <span class="keyword">new</span> ArrayList&lt;Fragment&gt;();</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> (DEBUG) Log.v(TAG, <span class="string">&quot;add: &quot;</span> + fragment);</span><br><span class="line"></span><br><span class="line">    <span class="comment">//激活fragment</span></span><br><span class="line">    makeActive(fragment);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (!fragment.mDetached) &#123;</span><br><span class="line">        <span class="keyword">if</span> (mAdded.contains(fragment)) &#123;</span><br><span class="line">            <span class="keyword">throw</span> <span class="keyword">new</span> IllegalStateException(<span class="string">&quot;Fragment already added: &quot;</span> + fragment);</span><br><span class="line">        &#125;</span><br><span class="line">        mAdded.add(fragment);</span><br><span class="line">        fragment.mAdded = <span class="keyword">true</span>;</span><br><span class="line">        fragment.mRemoving = <span class="keyword">false</span>;</span><br><span class="line">        <span class="keyword">if</span> (fragment.mHasMenu &amp;&amp; fragment.mMenuVisible) &#123;</span><br><span class="line">            mNeedMenuInvalidate = <span class="keyword">true</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (moveToStateNow) &#123;</span><br><span class="line">            moveToState(fragment);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">makeActive</span><span class="params">(Fragment f)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (f.mIndex &gt;= <span class="number">0</span>) &#123;</span><br><span class="line">        <span class="keyword">return</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (mAvailIndices == <span class="keyword">null</span> || mAvailIndices.size() &lt;= <span class="number">0</span>) &#123;</span><br><span class="line">        <span class="keyword">if</span> (mActive == <span class="keyword">null</span>) &#123;</span><br><span class="line">            <span class="comment">//激活Fragment</span></span><br><span class="line">            mActive = <span class="keyword">new</span> ArrayList&lt;Fragment&gt;();    </span><br><span class="line">        &#125;</span><br><span class="line">        f.setIndex(mActive.size(), mParent);</span><br><span class="line">        mActive.add(f);</span><br><span class="line"></span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        f.setIndex(mAvailIndices.remove(mAvailIndices.size()-<span class="number">1</span>), mParent);</span><br><span class="line">        mActive.set(f.mIndex, f);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> (DEBUG) Log.v(TAG, <span class="string">&quot;Allocated fragment index &quot;</span> + f);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/Android/" rel="tag"># Android</a>
              <a href="/tags/Fragment/" rel="tag"># Fragment</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2017/05/12/%E5%AE%89%E5%8D%93%EF%BC%9A%E4%B8%80%E4%B8%AA%E9%A1%B9%E7%9B%AE%E7%9A%84%E5%A4%9A%E7%A7%8D%E6%89%93%E5%8C%85%E6%96%B9%E5%BC%8F/" rel="prev" title="安卓：一个项目的多种打包方式">
      <i class="fa fa-chevron-left"></i> 安卓：一个项目的多种打包方式
    </a></div>
      <div class="post-nav-item">
    <a href="/2017/05/12/%E5%AE%89%E5%8D%93%E5%A4%87%E5%BF%98%EF%BC%9A%E8%B7%B3%E8%BD%AC%E7%B3%BB%E7%BB%9F%E9%A1%B5%E9%9D%A2%E4%BB%A5%E5%8F%8A%E5%B8%B8%E8%A7%81APP%E7%9B%B8%E5%BA%94%E9%A1%B5%E9%9D%A2/" rel="next" title="安卓备忘：跳转系统页面以及常见APP相应页面">
      安卓备忘：跳转系统页面以及常见APP相应页面 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F"><span class="nav-number">1.</span> <span class="nav-text">生命周期</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#setUserVisibleHint-%EF%BC%9A"><span class="nav-number">1.0.1.</span> <span class="nav-text">setUserVisibleHint()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onAttach-%EF%BC%9A"><span class="nav-number">1.0.2.</span> <span class="nav-text">onAttach()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onCreate-%EF%BC%9A"><span class="nav-number">1.0.3.</span> <span class="nav-text">onCreate()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onCreateView-%EF%BC%9A"><span class="nav-number">1.0.4.</span> <span class="nav-text">onCreateView()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onActivityCreated-%EF%BC%9A"><span class="nav-number">1.0.5.</span> <span class="nav-text">onActivityCreated()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onStart-%EF%BC%9A"><span class="nav-number">1.0.6.</span> <span class="nav-text">onStart()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onResume-%EF%BC%9A"><span class="nav-number">1.0.7.</span> <span class="nav-text">onResume()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onPause-%EF%BC%9A"><span class="nav-number">1.0.8.</span> <span class="nav-text">onPause()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onSaveInstanceState-%EF%BC%9A"><span class="nav-number">1.0.9.</span> <span class="nav-text">onSaveInstanceState()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onStop-%EF%BC%9A"><span class="nav-number">1.0.10.</span> <span class="nav-text">onStop()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onDestroyView-%EF%BC%9A"><span class="nav-number">1.0.11.</span> <span class="nav-text">onDestroyView()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onDestroy-%EF%BC%9A"><span class="nav-number">1.0.12.</span> <span class="nav-text">onDestroy()：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#onDetach-%EF%BC%9A"><span class="nav-number">1.0.13.</span> <span class="nav-text">onDetach()：</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%9C%8B%E4%B8%80%E4%B8%8B%E6%BA%90%E7%A0%81"><span class="nav-number">2.</span> <span class="nav-text">看一下源码</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%88%91%E4%BB%AC%E7%9A%84%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF%EF%BC%9A"><span class="nav-number">2.1.</span> <span class="nav-text">1. 我们的使用场景：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-ViewPager-FragmentPagerAdapter"><span class="nav-number">2.2.</span> <span class="nav-text">2.ViewPager ,FragmentPagerAdapter</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-Activity-FragmentManager"><span class="nav-number">2.3.</span> <span class="nav-text">3.  Activity , FragmentManager</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">vchao</p>
  <div class="site-description" itemprop="description">怀揣好奇，梦想改变世界的菜鸟极客</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">46</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">分类</span>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">27</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        
  <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">冀ICP备 17022751号-1 </a>
      <img src="https://beian.miit.gov.cn" style="display: inline-block;">
  </div>

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">vchao</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

</body>
</html>
